package gaml.testing;

import static org.junit.Assert.fail;
import gaml.error.GamlException;
import gaml.java.ClassSerializerStore;
import gaml.java.NodeObjectBridge;
import gaml.java.serializer.ComplexSerializerFactory;
import gaml.java.serializer.primitive.StringSerializer;
import gaml.yaml.ScalarNode;
import gaml.yaml.YamlNode;
import gaml.yaml.ahchor.YamlAnchorObjectStore;

import org.junit.Test;


public class StringSerializerTest {

	@Test
	public void testDeserialize () {
//		fail ("Not yet implemented");
	}

	@Test
	public void testSerialize () throws GamlException {
		String str = "string value";
		
		YamlAnchorObjectStore anchors = new YamlAnchorObjectStore (); 
		
		ClassSerializerStore store = new ClassSerializerStore ();
		store.setComplexFactory (new ComplexSerializerFactory (store));
		
		store.register (new StringSerializer ());
		
//		YamlNode node = store.get (String.class).serialize (str, new ScalarNode (null), anchors);
		
		YamlNode node = NodeObjectBridge.create (new ScalarNode (null), str, String.class, store).parseObject (anchors).getNode (); 
		
		System.out.println (node.getValue ());
	}
}